/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import com.zimbra.cs.redolog.Version;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class RevokeAccess
/*    */   extends RedoableOp
/*    */ {
/*    */   private int folderId;
/*    */   private String grantee;
/* 35 */   boolean dueToExpiry = false;
/*    */   
/*    */   public RevokeAccess() {
/* 38 */     super(MailboxOperation.RevokeAccess);
/* 39 */     this.folderId = 0;
/* 40 */     this.grantee = "";
/*    */   }
/*    */   
/*    */   public RevokeAccess(int mailboxId, int folderId, String grantee) {
/* 44 */     this(false, mailboxId, folderId, grantee);
/*    */   }
/*    */   
/*    */   public RevokeAccess(boolean dueToExpiry, int mailboxId, int folderId, String grantee) {
/* 48 */     this();
/* 49 */     if (dueToExpiry) {
/* 50 */       this.dueToExpiry = dueToExpiry;
/* 51 */       this.mOperation = MailboxOperation.ExpireAccess;
/*    */     }
/* 53 */     setMailboxId(mailboxId);
/* 54 */     this.folderId = folderId;
/* 55 */     this.grantee = (grantee == null ? "" : grantee);
/*    */   }
/*    */   
/*    */   protected String getPrintableData() {
/* 59 */     StringBuffer sb = new StringBuffer("id=").append(this.folderId);
/* 60 */     sb.append(", grantee=").append(this.grantee);
/* 61 */     if (this.dueToExpiry) {
/* 62 */       sb.append(", dueToExpiry=").append(this.dueToExpiry);
/*    */     }
/* 64 */     return sb.toString();
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException {
/* 68 */     out.writeInt(this.folderId);
/* 69 */     out.writeUTF(this.grantee);
/* 70 */     out.writeBoolean(this.dueToExpiry);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException {
/* 74 */     this.folderId = in.readInt();
/* 75 */     this.grantee = in.readUTF();
/* 76 */     if (getVersion().atLeast(1, 39)) {
/* 77 */       this.dueToExpiry = in.readBoolean();
/* 78 */       if (this.dueToExpiry) {
/* 79 */         this.mOperation = MailboxOperation.ExpireAccess;
/*    */       }
/*    */     }
/*    */   }
/*    */   
/*    */   public void redo() throws ServiceException {
/* 85 */     if (this.dueToExpiry)
/*    */     {
/* 87 */       return;
/*    */     }
/* 89 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/* 90 */     mbox.revokeAccess(getOperationContext(), this.dueToExpiry, this.folderId, this.grantee);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/RevokeAccess.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */